package com.atguigu.service.impl;

import com.atguigu.dao.impl.UserDaoImpl;
import com.atguigu.pojo.User;
import com.atguigu.service.UserService;

/**
 * @author Chen
 * @Description
 * @Version
 * @create 2021-09-27-11:51
 */
public class UserServiceImpl implements UserService {
        private UserDaoImpl userDao = new UserDaoImpl();

    @Override
    public void registerUser(User user) {
        userDao.saveUser(user);
    }


    @Override
    public User login(User user) {
        return userDao.queryUserByUsernameAndPassword(user.getUsername(), user.getPassword());
    }

    @Override
    public boolean existsUserName(String name) {
        return userDao.queryUserByUsername(name) != null?true:false;
    }
}
